package com.cloud.cop.business.service;

import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cloud.cop.CRUDException;
import com.cloud.cop.business.dao.UserDAO;
import com.cloud.cop.business.domain.Users;

@Service
public class UserService implements IService{
	
private UserDAO userDAO;
	
	@Autowired
	public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory){
		userDAO = new UserDAO<Users>(sqlSessionFactory, Users.class);
	}
	
	
	@Transactional(rollbackFor={CRUDException.class,RuntimeException.class})
	public void save() throws CRUDException{
		userDAO.save();
		userDAO.save2();
	}
}
